﻿using System;
using System.Collections.Generic;
using BehaviorModel;
using BehaviorModel.Block;
using CommandLogic.Data;

namespace CommandLogic.Command
{
    public class CreateBlockCommand : IQsmCommand
    {
        public CommandData Execute(CommandData data)
        {
            var blockData = (BlockData) data;
            var blockType = blockData.Type;
            var block = blockData.Block;

            block = block ?? BlockFactory.GetInstance().Create(blockType);
            BlockController.GetInstance().AddBlock(block);

            blockData.Block = block;
            return blockData;
        }
    }
}
